/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package goodenglish.domain.model.subt;

import goodenglish.infrastructure.TextParsing;

/**
 * 
 * @author 关攀攀 panpan_001@126.com
 */
public class SubtSentence {

	private long stime;
	private long etime;
	private String stimeStr;
	private String etimeStr;
	private String enStr;
	private String chStr;
	private Subt subt;

	public SubtSentence() {
	}

	public boolean isInTime(int currentPlayTime) {
		if (currentPlayTime <= this.getEtime() && currentPlayTime >= this.getStime()) {
			return true;
		} else {
			return false;
		}
	}

	public long getEtime() {
		return etime;
	}

	public long getStime() {
		return stime;
	}

	public void setStime(long stime) {
		this.stime = stime;
	}

	public void setEtime(long etime) {
		this.etime = etime;
	}

	/**
	 * 是否含有生单词
	 * 
	 * @param spell
	 * @return
	 */
	public boolean containsWord(String spell) {
		return TextParsing.containsWord(enStr, spell);
	}

	/**
	 * 得到句子的Html显示，关键词用红色
	 * 
	 * @param spell
	 * @return
	 */
	public String getHtmlWithRedKeyWord(String spell) {
		// str = "<font size=20>" + str + "</font>";
		return enStr.replaceAll(spell, "<font color=red>" + spell + "</font>") + "<br/>" + chStr + "<br/>";
	}

	public String getChStr() {
		return chStr;
	}

	public void setChStr(String chStr) {
		this.chStr = chStr;
	}

	public String getEnStr() {
		return enStr;
	}

	public String getEnAndWordExplainStr() {
		return enStr;
	}

	public void setEnStr(String enStr) {
		this.enStr = enStr;
	}

	public String getStimeStr() {
		return stimeStr;
	}

	public void setStimeStr(String timeStr) {
		this.stimeStr = timeStr;
	}

	public String getEtimeStr() {
		return etimeStr;
	}

	public void setEtimeStr(String etimeStr) {
		this.etimeStr = etimeStr;
	}

	public static void main(String[] args) {
		String str = "01:01:14  - 你干嘛了? - 我治好了他 - What did you do? - I fixed him.";
		String[] subStr = str.substring(0, 8).split(":");
		int intElapsed = Integer.valueOf(subStr[0]) * 60 * 60 + Integer.valueOf(subStr[1]) * 60 + Integer.valueOf(subStr[2]);
		System.out.println(intElapsed);
	}
}
